<script setup>
// 1. svg 图标得自定义, 图标是一个占位符, 用户自己传递
// 2. 按钮里面的两个数字, 得用户自己传递
// 3. 背景颜色 用户可以自定义
// 4. 边框颜色用户可以自定义
defineProps({
  leftText: {
    type: String,
    default() {
      return 'now!'
    }
  },
  rightText: {
    type: String,
    default() {
      return 'play'
    }
  },
  textSize: {
    type: String,
    default() {
      return '17px'
    }
  },
  bgc: {
    type: String,
    default() {
      return 'hsl(49deg 98% 60%)'
    }
  },
  brdColor: {
    type: String,
    default() {
      return 'black'
    }
  },
  brdRadius: {
    type: String,
    default() {
      return '50px'
    }
  }
})
</script>
<template>
  <div style="display: inline-block">
    <button
      :style="{
        backgroundColor: bgc,
        fontSize: textSize,
        borderRadius: brdRadius,
        borderColor: brdColor
      }"
    >
      <slot name="svg" class="svg"></slot>
      <span class="now">{{ leftText }}</span>
      <span class="play">{{ rightText }}</span>
    </button>
  </div>
</template>
<style scoped>
/* From Uiverse.io by barisdogansutcu */
button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 10px;
  color: white;
  text-shadow: 2px 2px rgb(116, 116, 116);
  text-transform: uppercase;
  cursor: pointer;
  border: solid 2px black;
  letter-spacing: 1px;
  font-weight: 600;
  /* font-size: 17px; */
  /* background-color: hsl(49deg 98% 60%); */
  border-radius: 50px;
  position: relative;
  overflow: hidden;
  transition: all 0.5s ease;
}

button:active {
  transform: scale(0.9);
  transition: all 100ms ease;
}

/* button svg {
  transition: all 0.5s ease;
  z-index: 2;
} */

::v-deep svg {
  transition: all 0.5s ease;
  z-index: 2;
}

.play {
  transition: all 0.5s ease;
  /* transition-delay: 300ms; */
}

button:hover ::v-deep svg {
  transform: scale(3) translate(50%);
}

.now {
  position: absolute;
  left: 0;
  transform: translateX(-150%);
  transition: all 0.5s ease;
  z-index: 2;
}

button:hover .now {
  transform: translateX(10px);
  /* transition-delay: 300ms; */
}

button:hover .play {
  transform: translateX(200%);

  /* transition-delay: 300ms; */
}
</style>
